
#include "stdafx.h"
#include "NewSlaveWizard.h"


CNewWizardSheet::CNewWizardSheet(CUsbComm* pusb, Slave_Flash_Section flash_to_write, UINT uStartPage, HWND hWndParent) :
	baseClass(_T("Test Wizard"), IDB_WIZ97_HEADER, IDB_WIZ97_WATERMARK, uStartPage, hWndParent),
	m_pageFinding(pusb, flash_to_write), m_pageNaming(flash_to_write.Code_Slave_ID)
{	
	this->AddPage(m_pageWelcome);
	this->AddPage(m_pageFinding);
	this->AddPage(m_pageNaming);
	this->AddPage(m_pageCompletion);
}


LRESULT CWizardWelcomePage::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	CFontHandle fontExteriorPageTitleFont(baseClass::GetExteriorPageTitleFont());
	CFontHandle fontBulletFont(baseClass::GetBulletFont());

	CWindow title = this->GetDlgItem(IDC_WIZ97_EXTERIOR_TITLE);
	CWindow bullet1 = this->GetDlgItem(IDC_WIZ97_BULLET1);
	CWindow bullet2 = this->GetDlgItem(IDC_WIZ97_BULLET2);
	
	title.SetFont(fontExteriorPageTitleFont);
	bullet1.SetFont(fontBulletFont);
	bullet2.SetFont(fontBulletFont);
	
	return 1;
}

// Overrides from base class
int CWizardWelcomePage::OnSetActive()
{
	this->SetWizardButtons(PSWIZB_NEXT);

	// 0 = allow activate
	// -1 = go back to page that was active
	// page ID = jump to page
	return 0;
}

int CWizardWelcomePage::OnWizardNext()
{
	// 0  = goto next page
	// -1 = prevent page change
	// >0 = jump to page by dlg ID
	return 0;
}

LRESULT CWizardCompletionPage::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	CFontHandle fontExteriorPageTitleFont(baseClass::GetExteriorPageTitleFont());

	CWindow title = this->GetDlgItem(IDC_WIZ97_EXTERIOR_TITLE);
	title.SetFont(fontExteriorPageTitleFont);

	return 1;
}

int CWizardCompletionPage::OnSetActive()
{
	this->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);

	// 0 = allow activate
	// -1 = go back to page that was active
	// page ID = jump to page
	return 0;
}

int CWizardCompletionPage::OnWizardBack()
{
	// 0  = goto previous page
	// -1 = prevent page change
	// >0 = jump to page by dlg ID
	return 0;
}

INT_PTR CWizardCompletionPage::OnWizardFinish()
{
	CWaitCursor waitCursor;

	bool success = true; 

	// FALSE = allow finish
	// TRUE = prevent finish
	// HWND = prevent finish and set focus to HWND (CommCtrl 5.80 only)
	return success ? FALSE : TRUE;
}


int CWizardFindingPage::OnWizardBack()
{
	return 0;
}

